public var owner : NetworkPlayer;
private var lastHinput : float = 0;
private var lastVinput : float = 0;

private var serverHinput : float = 0;
private var serverVinput : float = 0;

@RPC
function enablePlayer(p : NetworkPlayer) {
	owner = p;
	if (owner == Network.player) {
		enabled = true;
	}
}

function Update () {
	if (owner != null && Network.player == owner) {
		var Hinput : float = Input.GetAxis("Horizontal");
		var Vinput : float = Input.GetAxis("Vertical");
		
		if (Hinput != lastHinput || Vinput != lastVinput) {
			lastHinput = Hinput;
			lastVinput = Vinput;
			
			networkView.RPC("moviment",RPCMode.Server, Hinput, Vinput);

		}
		
		var moveDir2 : Vector3 = new Vector3(lastHinput,0,lastVinput);
		transform.Translate(5.0 * moveDir2 * Time.deltaTime);		
	}
	
	if (Network.isServer) {
		var moveDir : Vector3 = new Vector3(serverHinput,0,serverVinput);
		transform.Translate(5.0 * moveDir * Time.deltaTime);
	}
}

@RPC
function moviment(H : float, V: float) {
	serverHinput = H;
	serverVinput = V;
}